package com.shpng.cheapenglish.action.nouse;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shpng.cheapenglish.db.Word;
import com.shpng.cheapenglish.manager.WordManager;
import com.shpng.cheapenglish.util.StringUtils;

public class WordModifyAction {

	private long wordId;

	private String wordString;

	private String meaning;

	private String instance;

//	public String execute(HttpServletRequest req, HttpServletResponse resp)
//			throws ServletException, IOException {
//		WordManager wordManager = WordManager.getInstance();
//		if (wordId > 0) {
//			Word word = wordManager.getWord(wordId);
//			if (word != null) {
//
//				word.setWordString(wordString);
//				word.setMeaning(meaning);
//
//				if (!StringUtils.isEmpty(instance)) {
//					if (word.getInstances() == null) {
//						List<String> instances = new ArrayList<String>();
//						instances.add(instance);
//						word.setInstances(instances);
//					} else {
//						word.getInstances().add(instance);
//					}
//				}
//
//				wordManager.saveWord(word);
//				req.setAttribute("word", word);
//			}
//			
//		}
//		
//		return "/pages/word-modify.jsp";
//	}

	public long getWordId() {
		return wordId;
	}

	public void setWordId(long wordId) {
		this.wordId = wordId;
	}

	public String getWordString() {
		return wordString;
	}

	public void setWordString(String wordContent) {
		this.wordString = wordContent;
	}

	public String getMeaning() {
		return meaning;
	}

	public void setMeaning(String meaning) {
		this.meaning = meaning;
	}

	public String getInstance() {
		return instance;
	}

	public void setInstance(String instance) {
		this.instance = instance;
	}

}
